/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.anhanguera.tcc.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego
 */
@Entity
@Table(name = "tb_empenho")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Empenho.findAll", query = "SELECT e FROM Empenho e"),
    @NamedQuery(name = "Empenho.findByIdEmpenho", query = "SELECT e FROM Empenho e WHERE e.idEmpenho = :idEmpenho"),
    @NamedQuery(name = "Empenho.findByNuEmpenho", query = "SELECT e FROM Empenho e WHERE e.nuEmpenho = :nuEmpenho"),
    @NamedQuery(name = "Empenho.findByVlEmpenho", query = "SELECT e FROM Empenho e WHERE e.vlEmpenho = :vlEmpenho")})
public class Empenho implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_EMPENHO")
    private Integer idEmpenho;
    @Basic(optional = false)
    @Column(name = "NU_EMPENHO")
    private String nuEmpenho;
    @Basic(optional = false)
    @Column(name = "VL_EMPENHO")
    private int vlEmpenho;
    @JoinColumn(name = "COD_CONTRATO", referencedColumnName = "ID_CONTRATO")
    @ManyToOne(optional = false)
    private Contrato codContrato;

    public Empenho() {
    }

    public Empenho(Integer idEmpenho) {
        this.idEmpenho = idEmpenho;
    }

    public Empenho(Integer idEmpenho, String nuEmpenho, int vlEmpenho) {
        this.idEmpenho = idEmpenho;
        this.nuEmpenho = nuEmpenho;
        this.vlEmpenho = vlEmpenho;
    }

    public Integer getIdEmpenho() {
        return idEmpenho;
    }

    public void setIdEmpenho(Integer idEmpenho) {
        this.idEmpenho = idEmpenho;
    }

    public String getNuEmpenho() {
        return nuEmpenho;
    }

    public void setNuEmpenho(String nuEmpenho) {
        this.nuEmpenho = nuEmpenho;
    }

    public int getVlEmpenho() {
        return vlEmpenho;
    }

    public void setVlEmpenho(int vlEmpenho) {
        this.vlEmpenho = vlEmpenho;
    }

    public Contrato getCodContrato() {
        return codContrato;
    }

    public void setCodContrato(Contrato codContrato) {
        this.codContrato = codContrato;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEmpenho != null ? idEmpenho.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Empenho)) {
            return false;
        }
        Empenho other = (Empenho) object;
        if ((this.idEmpenho == null && other.idEmpenho != null) || (this.idEmpenho != null && !this.idEmpenho.equals(other.idEmpenho))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.anhanguera.tcc.model.Empenho[ idEmpenho=" + idEmpenho + " ]";
    }

}
